#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Datetime: 2023/3/21 18:13
# @Author  : CHENWang
# @Site    : 
# @File    : test.py
# @Software: PyCharm

"""
脚本说明:
"""

import os
import pandas as pd
import yfinance as yf
DATA_DIR = f'E:\\指标数据'  # 用于存放测试数据

if __name__ == '__main__':
    # coinbase = yf.download('COIN', start='2018-01-01', end='2023-03-20', interval='1d')
    tqqq = yf.download('TQQQ', start='2020-01-01', end='2023-03-20', interval='1d')

    tqqq.index = pd.to_datetime(tqqq.index)
    tqqq.index = tqqq.index.astype(str)
    tqqq_market_cap1 = tqqq.loc['2021-04-14':'2021-06-30', 'Close'] * 210000000
    tqqq_market_cap2 = tqqq.loc['2021-07-01':'2021-12-31', 'Close'] * 215000000
    tqqq_market_cap3 = tqqq.loc['2022-01-03':'2022-03-31', 'Close'] * 220000000
    tqqq_market_cap4 = tqqq.loc['2022-04-01':'2023-03-20', 'Close'] * 225000000
    tqqq_market_cap = pd.concat([tqqq_market_cap1, tqqq_market_cap2, tqqq_market_cap3, tqqq_market_cap4])
    tqqq['market_cap'] = tqqq_market_cap

    backup_path = os.path.join(DATA_DIR, f'cex_coins_data')
    file_name = os.path.join(backup_path, f'tqqq')
    tqqq.to_excel(f'{file_name}.xlsx')
